#include <stdio.h>
#include "views.h"
#include "InputHelper.h"
#include "admin.h"
#include "playGame.h"
//
// Created by 24994 on 2021/9/30.
//

void start()
{
    extern int onOrOff;
    // database
    while(onOrOff){
        // 显示游戏的主页面
        mainView();
        // 选择游戏选项
        int res = inputNum("please input your select\n");
        switch (res){
            case 1: // 管理员登录
                adminLogin();
                break;
            case 2: //  玩家登录
                //todo 玩家登录
                // 展示选择角色页面
                roleSelect();
                int roleNum = inputNum("please select your role\n");
                switch (roleNum){
                    case 1:
                        printf("system find your face so big,so surprise\n");
                        printf("your choose sunWuKong,system auto help you choose baiGuJin\n");
                        break;
                    case 2:
                        printf("you choose baiGuJin\n");
                        break;
                    default:
                        printf("system help you choose BaiGuJin\n");
                        break;
                }
                // 进行游戏
                playGame(roleNum);
                break;
            case 3: //  游戏介绍
                gameDesc();
                break;
            case 4: //  英雄榜
                break;
            case 0: //  退出游戏
                onOrOff = 0;
                printf("good bye,hope see you next");
                break;
            default:
                printf("input error,please input again");
                break;
        }
    }
}
